﻿using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
using QuanLyTuyenSinh.Base;
using QuanLyTuyenSinh.DataLayer;

namespace QuanLyTuyenSinh.Operator
{
    public partial class Operator
    {
        static readonly DataConfig DataConfig = new DataConfig(frmLoading.Servername, frmLoading.UserName, frmLoading.Pass);
        static DataTable _dtTable = new DataTable();
        public static DataTable GetListProvince()
        {
            _dtTable = new DataTable();
            string sql = "SELECT * From Province";
            try
            {
                _dtTable = DataConfig.GetDataTable(sql);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return _dtTable;
        }

        public static DataTable GetListProvinceById(long ethnicId)
        {
            _dtTable = new DataTable();
            string sql = string.Format("SELECT * FROM Province Where Id= N'{0}'", ethnicId);
            try
            {
                _dtTable = DataConfig.GetDataTable(sql);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return _dtTable;
        }
    }
}